package com.shi.exception;

import com.shi.common.ResultCodeEnum;

public class BusinessException extends RuntimeException {

    private ResultCodeEnum resultCodeEnum;
    private String message;
    private Integer code;

    public BusinessException(String message) {
        this.message = message;
        this.resultCodeEnum = ResultCodeEnum.FAIL;
    }

    public BusinessException(ResultCodeEnum resultCodeEnum) {
        this.message = resultCodeEnum.getMessage();
        this.code = resultCodeEnum.getCode();
    }

    public BusinessException(ResultCodeEnum resultCodeEnum, String message) {
        this.message = message;
        this.code = resultCodeEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
